using System;
using System.Collections.Generic;
using System.Text;

namespace Parsifal
{
    public abstract class ManageGenericsArray<T>
    {

        private List<T> iArray;

        private int progressIndex = 0;

        public ManageGenericsArray()
        {

            try
            {
                //costruttore
                iArray  = new List<T>();
            }
            catch (Exception err)
            {

                
                throw err;
            }
        }

        public List<T> Array
        {
            get
            {
                return iArray;
            }
           
        }


        protected int AddElementToArray(T aElement)
        {
            try
            {
                iArray.Add(aElement);
                //cambiamento incerto
                int res = progressIndex;

                progressIndex++;
                //int res = iArray.Count - 1;


                
                


                return res;
            }
            catch(Exception err)
            {
                throw err;
            }
        }

        protected void RemoveElementToArray(int aIndex)
        {
            try
            {
                //cambiamento incerto
                
                
                iArray.RemoveAt(aIndex);
               
            }
            catch (Exception err)
            {
                throw err;
            }
        }


        protected void RemoveElementToArray(T aItem)
        {
            try
            {
                //cambiamento incerto


               iArray.Remove(aItem);

            }
            catch (Exception err)
            {
                throw err;
            }
        }


       

       
    }
}
